package com.example.widget.custom;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import androidx.annotation.Nullable;

public class SignView extends LinearLayout {

    private Paint paint;
    private Paint textPaint;
    private Paint linePaint;
    private Paint linePaint1;

    public SignView(Context context) {
        super(context);
    }
    public SignView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        setOrientation(VERTICAL);
        init();
    }

    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {

    }

    private void init() {
        paint = new Paint();
        paint.setStyle(Paint.Style.STROKE);
        paint.setColor(Color.parseColor("#E33C1F"));
        paint.setAntiAlias(true);
        paint.setStrokeWidth(4);
        paint.setTextSize(15);

        textPaint=new Paint();
        textPaint.setStyle(Paint.Style.FILL);
        textPaint.setColor(Color.parseColor("#E33C1F"));
        textPaint.setAntiAlias(true);
        textPaint.setStrokeWidth(4);

//        linePaint=new Paint();
//        linePaint.setStyle(Paint.Style.FILL);
//        linePaint.setColor(Color.parseColor("#70FF1D"));
//        linePaint.setAntiAlias(true);
//        linePaint.setStrokeWidth(5);
//
//        linePaint1=new Paint();
//        linePaint1.setStyle(Paint.Style.FILL);
//        linePaint1.setColor(Color.parseColor("#FFDA28"));
//        linePaint1.setAntiAlias(true);
//        linePaint1.setStrokeWidth(5);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        RectF rectF = new RectF(0, 0, 100, 100);
        canvas.drawArc(rectF,0,360,false,paint);
//        canvas.drawRect(rectF,linePaint);
        RectF rectF1 = new RectF(5, 5, 95, 95);
        canvas.drawArc(rectF1,0,360,true,textPaint);
//        canvas.drawRect(rectF1,linePaint1);
    }
}
